$(function() {
var innerWidth = $(window).innerWidth();
var myDate = new Date;
var date = myDate.getDate();
var time = myDate.getTime();
var swiper_one = new Date('2022/04/18 09:54:00').getTime();
var swiper_two = new Date('2022/04/19 09:30:00').getTime();
var swiper_three = new Date('2022/04/20 09:30:00').getTime();
// var inrHeight = $('.S03').offset().top;
// var winHeight = $(window).scrollTop();
$('.reserve_video').on('click', function(e) {
if ($('.S01 .addEvent_drop').is(':hidden')) {
$('.S01 .addEvent_drop').show()
}
e.stopPropagation();
})
$(document).bind('click', function(e) {
$('.S01 .addEvent_drop').hide();
e.stopPropagation();
})
function swiperInit() {
let mySwiper02 = new Swiper('.swiper', {
speed: 1000,
loop: true,
spaceBetween: 0,
autoplay: {
disableOnInteraction: false,
delay: 10000,
},
pagination: {
el: '.swiper .swiper-pagination',
clickable: false,
},
navigation: {
prevEl: '.swiper-button-prev',
nextEl: '.swiper-button-next',
},
on: {
slideChangeTransitionStart: function() {
if (innerWidth > 768) {
$('.swiper .strip').stop();
$('.swiper .strip').stop().css({
'width': 0,
});
}
},
slideChangeTransitionEnd: function() {
if (innerWidth > 768) {
$('.swiper .swiper-pagination-bullet-active .strip').animate({
width: '100%',
}, 10000, function() {
$('.swiper .strip').css({
'width': 0,
})
});
}
}
}
});
if (innerWidth > 768) {
var div_ = '
';
$('.swiper .swiper-pagination-bullet').append(div_);
$('.swiper .swiper-pagination-bullet-active .strip').animate({
width: '100%',
}, 10000, function() {
$('.swiper .strip').css({
'width': 0,
})
});
}
}
if (date < 18) {
$('.S03').css('display', 'none');
} else if ((date > 17) && (date < 19) && swiper_one < time) {
$('.swiper-one').css('display', 'block');
$('.swiper-two').css('display', 'none');
$('.swiper-three').css('display', 'none');
$('.S03 .swiper-button-next, .S03 .swiper-button-prev').css('display', 'none');
} else if ((date > 18) && (date < 20) && swiper_two < time) {
$('.swiper-one').css('display', 'none');
$('.swiper-two').css('display', 'block');
$('.swiper-three').css('display', 'none');
$('.S03 .swiper-button-next, .S03 .swiper-button-prev').css('display', 'block');
var flag = false;
$(window).scroll(function() {
var s03ScrollTop = $(document).scrollTop() - $('.S03').offset().top;
if (s03ScrollTop > (-300) && !flag) {
swiperInit();
flag = true;
}
var videoHeight = parseInt($(window).scrollTop() - $('.S03').offset().top);
if (videoHeight > 0) {
$('.S03 .bg_video video').css('position', 'relative !important');
}
});
} else if (date > 19 && swiper_three < time) {
$('.swiper-one').css('display', 'none');
$('.swiper-two').css('display', 'none');
$('.swiper-three').css('display', 'block');
$('.S03 .swiper-button-next, .S03 .swiper-button-prev').css('display', 'block');
var flag = false;
$(window).scroll(function() {
var s03ScrollTop = $(document).scrollTop() - $('.S03').offset().top;
if (s03ScrollTop > (-300) && !flag) {
swiperInit();
flag = true;
}
var videoHeight = parseInt($(window).scrollTop() - $('.S03').offset().top);
if (videoHeight > 0) {
$('.S03 .bg_video video').css('position', 'relative');
}
});
} else {
$('.swiper-one').css('display', 'none');
$('.swiper-two').css('display', 'none');
$('.swiper-three').css('display', 'none');
$('.S03 .swiper-button-next, .S03 .swiper-button-prev').css('display', 'none');
}
});